package org.yf.samples.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name = "exam_user")
public class User implements Serializable {

	private static final long serialVersionUID = -6600420177734357380L;
	
	@Id
	@Column(name = "user_id", length = 10, nullable = false)
	private String userId;//学号、老师号、管理员号
	
	@Column(name = "user_name", length = 45, nullable = false)
	private String userName;//姓名

	@Column(name = "password", length = 255, nullable = false)
	private String password;//密码
	
	@Column(name = "tel", length = 20, nullable = true)
	private String tel;//联系电话

	@Column(name = "email", length = 255, nullable = true)
	private String email;//邮箱

	@Column(name = "address", length = 255, nullable = true)
	private String address;//地址
	
	@Column(name = "birthday", nullable = false)
	private String birthday;//生日

	@Column(name = "gender", length = 11, nullable = false)
	private String gender;//性别\n0：男，1：女

	@Column(name = "last_lock_time", nullable = true)
	private Date lastLockTime;//2016-01-01 00:00:00

	@Column(name = "login_fail_count", length = 1, nullable = true)
	private int loginFailCount;//0
	
	@OneToMany(mappedBy = "user")
	private Set<UserSubject> userSubject;
	
	@OneToMany(mappedBy = "user")
	private Set<ExamUserRole> examUserRole;
	
	@OneToMany(mappedBy = "user")
	private Set<ExamScore> examScore;
	
	public User(){
		super();
	}
	
	public User(String userId, String userName, String password, String tel, String email, String address, String birthday, String gender, Date lastLockTime, int loginFailCount){
		super();
		this.userId = userId;
		this.userName = userName;
		this.password = password;
		this.tel = tel;
		this.email = email;
		this.address = address;
		this.birthday = birthday;
		this.gender = gender;
		this.lastLockTime = lastLockTime;
		this.loginFailCount = loginFailCount;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public Date getLastLockTime() {
		return lastLockTime;
	}

	public void setLastLockTime(Date lastLockTime) {
		this.lastLockTime = lastLockTime;
	}

	public int getLoginFailCount() {
		return loginFailCount;
	}

	public void setLoginFailCount(int loginFailCount) {
		this.loginFailCount = loginFailCount;
	}

	public Set<UserSubject> getUserSubject() {
		return userSubject;
	}

	public void setUserSubject(Set<UserSubject> userSubject) {
		this.userSubject = userSubject;
	}

	public Set<ExamUserRole> getExamUserRole() {
		return examUserRole;
	}

	public void setExamUserRole(Set<ExamUserRole> examUserRole) {
		this.examUserRole = examUserRole;
	}
	
}
